package com.weimob.controller;

import com.sun.tools.javac.util.ServiceLoader;
import com.weimob.spi.InternetService;
import org.junit.Test;

import java.util.Iterator;

/**
 * @program: spi-demo
 * @description:
 * @author: sch
 * @create: 2022-08-28 20:43
 **/
public class InternetController {
    @Test
    public void connectInternet() {
        ServiceLoader<InternetService> load = ServiceLoader.load(InternetService.class);

        Iterator<InternetService> iterator = load.iterator();
        while (iterator.hasNext()) {
            InternetService internetService = iterator.next();
            internetService.connectInternet();
        }


    }
}
